var express = require('express');
const { default: mongoose } = require('mongoose');
var router = express.Router();
const {packageModel,storeModel} = require('../model/jyl_model')
//获取列表
router.get("/packagelist", async (req, res) => {
    let page = req.query.pagenum;
    console.log(req.query.pagenum);
    let pagesize = req.query.pagesize || 3;
    let data = await packageModel.find()
    .limit(pagesize)
    .skip((page - 1) * pagesize)
    .populate("store").exec();
    res.send({
      code: 200,
      data: data,
      msg: "获取列表成功",
    });
  });

//获取店铺
router.get("/storelist", async (req, res) => {

  let data = await storeModel.find().exec();
  res.send({
    code: 200,
    data: data,
    msg: "获取列表成功",
  });
});
module.exports = router;